Deuteronomy 20:8-9

20:8 In addition, the officers are to say to the troops, “Who among you is afraid and fainthearted? He may go home so that he will not make his fellow soldier’s heart as fearful as his own.” 20:9 Then, when the officers have finished speaking, they must appoint unit commanders to lead the troops.